#pragma once

#include "umtl/smart_ptr/smart_ptr.hpp"
#include "umtl/memory_stream/memory_stream.h"
#include <array>

class send_packet_stream
{
public:
	typedef umtl::smart_ptr< send_packet_stream > ptr;
	static size_t const buffer_size = 4096;

	send_packet_stream();

	void clear();

	umtl::memory_stream& stream();

	template< typename data_type >
	send_packet_stream& operator<<(data_type const & data)
	{
		stream_ << data;
		return *this;
	}

private:
	std::tr1::array<char, buffer_size> buffer_array_;
	umtl::memory_buffer buffer_;
	umtl::memory_stream stream_;
};